﻿using NDI;
using Newtonsoft.Json;
using NPortableEngine;
using Services4KouDai.Encrypt;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;

namespace Services4KouDai
{
    internal static class Extensions
    {
        public static ServiceRespInfo ToServiceInfo(this BackData backData)
        {
            return new ServiceRespInfo(backData.IsSuccess, backData.Msg, backData.ResponseData);
        }

        public static string EncryptDic(this Dictionary<string, object> paras)
        {
            var encryptor = ServiceModule.ServiceContainer.Resolve<IEncrypt>();
            return WebUtility.UrlEncode(encryptor.AESEncrypt(JsonConvert.SerializeObject(paras), "00118c9b7604620d7c73f720639de613", null));
        }
    }
}
